package org.brisling.sysman.domain;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.TableGenerator;
import javax.persistence.Transient;

import org.brisling.base.domain.impl.BaseDeptDomain;
import org.brisling.base.domain.inf.BaseDeptDomainInf;
import org.brisling.base.domain.inf.BaseTreeNodeInf;
import org.brisling.common.ConstSysParam;

import com.fasterxml.jackson.annotation.JsonIgnore;


/**
 * 
 * 用户实体类
 * @author : jackson wang
 * @Date   : 2015年10月8日 下午10:01:07
 * @version: 1.0
 * 
 */

@Entity
@Table(name=ConstSysParam.MODULE_USER)
public class Users extends BaseDeptDomain implements BaseDeptDomainInf,BaseTreeNodeInf{
	
	
	
	@Column
	private String password;
	
	
	@Column
	private String password_salt;
	
	/*
	 * 登录名称
	 */
	@Column(name="loginname")
	private String loginName;
	
	/*
	 * 用户代码
	 */
	@Column
	private String userCode;	
	
	
	
	/*
	 * 工作电话
	 */
	@Column
	private Integer workphone;
	
	/*
	 * 移动电话
	 */
	@Column
	private Integer mobile;	
	
	
	/*
	 * 账号过期标志
	 */
	@Column(length=1)
	private String accountNonExpired;
	
	/*
	 * 账号锁定标志
	 */
	@Column(length=1)
	private String accountNonLocked ;
	
	/*
	 * 信任状态标志
	 */
	@Column(length=1)
	private String credentialsNonExpired ;
	
	/*
	 * 启用状态
	 */
	@Column(length=1)
	private String enabled ;
	
	
	@Column
	private String email;
	
	/*
	 * user second dept
	 */
	@Transient
	@JsonIgnore
	private Department secondDept;
	
	@Transient
	private String secondDeptName;
	
	
	

	/*
	 * all Department that current user must serviced for it 
	 */
	@Transient	
	private List<Department> managedDept;
	
	
	
	
	/*
	 * current user managed roles
	 */
	@Transient
	private List<Roles> relationRoles;
	
	
	
	
	@Transient
	private List<Permissions> relationPermissions;
	
	@Transient
	private List<JobRole> jobrole;
	
	//get the project special ui and other setting from config file
	//@Transient
	//private AppCustomConfig customConfig;
	
	
	@Transient
	private String jobname;
	
	@Transient
	private Long parentid;
	
	@Transient
	private String parentName;
	
	@Transient
	private String text;
	
	@Transient
	private String State;
	
	@Transient
	private String nodeType = "L";
	
	//实际id值
	@Transient
	private Long rid;
	
	
	public Long getRid() {
		return rid;
	}


	public void setRid(Long rid) {
		this.rid = rid;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getLoginName() {
		return loginName==null?"":loginName;
	}

	public void setLoginname(String loginName) {
		this.loginName = loginName;
	}

	public String getUserCode() {
		return userCode==null?"":userCode;
	}

	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}

	

	public Integer getWorkphone() {
		return workphone;
	}

	public void setWorkphone(Integer workphone) {
		this.workphone = workphone;
	}

	public Integer getMobile() {
		return mobile;
	}

	public void setMobile(Integer mobile) {
		this.mobile = mobile;
	}

	
	public void setAccountNonLocked(String accountNonLocked) {
		this.accountNonLocked = accountNonLocked;
	}

	

	public void setCredentialsNonExpired(String credentialsNonExpired) {
		this.credentialsNonExpired = credentialsNonExpired;
	}

	

	public void setEnabled(String enabled) {
		this.enabled = enabled;
	}

	public Department getSecondDept() {
		return secondDept;
	}

	public void setSecondDept(Department secondDept) {
		this.secondDept = secondDept;
	}

	public List<Department> getManagedDept() {
		return managedDept;
	}

	public void setManagedDept(List<Department> managedDept) {
		this.managedDept = managedDept;
	}

	

	

	public String getAccountNonLocked() {
		return accountNonLocked;
	}

	public String getCredentialsNonExpired() {
		return credentialsNonExpired;
	}

	public String getEnabled() {
		return enabled;
	}	

	
	public void eraseCredentials() {
		// TODO Auto-generated method stub
		this.password = null;
		this.password_salt = null;
	}




	public List<Roles> getRelationRoles() {
		return relationRoles;
	}




	public void setRelationRoles(List<Roles> relationRoles) {
		this.relationRoles = relationRoles;
	}


	public List<Permissions> getRelationPermissions() {
		return relationPermissions;
	}




	public void setRelationPermissions(List<Permissions> relationPermission) {
		this.relationPermissions = relationPermission;		
	}




	public String getPassword_salt() {
		return password_salt;
	}




	public void setPassword_salt(String password_salt) {
		this.password_salt = password_salt;
	}




	public String getEmail() {
		return email;
	}




	public void setEmail(String email) {
		this.email = email;
	}




	public String getSecondDeptName() {
		return secondDeptName;
	}




	public void setSecondDeptName(String secondDeptName) {
		this.secondDeptName = secondDeptName;
	}




	public String getAccountNonExpired() {
		return accountNonExpired;
	}




	public void setAccountNonExpired(String accountNonExpired) {
		this.accountNonExpired = accountNonExpired;
	}

	public String getJobname() {
		return jobname;
	}

	public void setJobname(String jobname) {
		this.jobname = jobname;
	}

	public List<JobRole> getJobrole() {
		return jobrole;
	}

	public void setJobrole(List<JobRole> jobrole) {
		this.jobrole = jobrole;
	}

	public Long getParentid() {
		return parentid;
	}

	public void setParentid(Long parentid) {
		this.parentid = parentid;
	}

	public String getParentName() {
		return parentName;
	}

	public void setParentName(String parentName) {
		this.parentName = parentName;
	}

	public String getText() {
		return name;
	}

	public void setText(String text) {
		this.name = text;
	}

	public String getState() {
		return State;
	}

	public void setState(String state) {
		State = state;
	}

	public String getNodeType() {
		return nodeType;
	}

	public void setNodeType(String nodeType) {
		this.nodeType = nodeType;
	}

	public void setLoginName(String loginName) {
		this.loginName = loginName;
	}

	@Override
	public String getFullBizcode() {
		// TODO Auto-generated method stub
		return bizcode;
	}

	@Override
	public void setFullBizcode(String bizcode) {
		// TODO Auto-generated method stub
		this.bizcode = bizcode;
	}
	
	

}
